package fr.univ.lr.icone.gui;

import java.awt.Graphics;

import javax.swing.JPanel;

import fr.univ.lr.icone.gui.zonerender.ColorOpinionMapping;

/**
 * Panel that contains elements of the legend in the GUI
 * 
 * @author Elian ORIOU
 * 
 */

public class OpinionLegend extends JPanel {

	private static final int LEGEND_OVAL_DIAMETER = 25;

	private static final long serialVersionUID = 1L;

	public OpinionLegend() {
		super();
	}

	@Override
	public void paint(Graphics g) {
		int x = getWidth() / 2;
		int y = 10;

		for (int i = 0; i < 10; i++) {
			g.setColor(ColorOpinionMapping.getColor(i));
			g.fillOval(x, y, LEGEND_OVAL_DIAMETER, LEGEND_OVAL_DIAMETER);
			g.drawString("" + i, x + 30, y + 10);
			y += 28;
		}
	}
}
